package com.matt.repository.course;

import com.matt.domain.course.CourseTopic;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Date;
import java.util.List;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/3/8
 * *******************************
 */
public interface CourseTopicRepository extends JpaRepository<CourseTopic, String>{
    List<CourseTopic> findByTargetObjectIdInAndBeginDateLessThanEqualAndEndDateGreaterThanEqual(String[] targetObjectId, Date beginDate, Date endDate);
    List<CourseTopic> findByBeginDateLessThanEqualAndEndDateGreaterThanEqual(Date beginDate, Date endDate);

    List<CourseTopic> findByTargetObjectIdInAndBeginDateLessThanEqualAndEndDateGreaterThanEqualAndIdNot(String[] targetObjectId, Date beginDate, Date endDate, String topicId);
    List<CourseTopic> findByBeginDateLessThanEqualAndEndDateGreaterThanEqualAndIdNot(Date beginDate, Date endDate, String topicId);

    CourseTopic findByTargetObjectIdAndBeginDateLessThanEqualAndEndDateGreaterThanEqual(String targetObjectId, Date date1, Date date2);

    List<CourseTopic> findByTargetObjectIdAndBeginDateAfter(String targetObjectId, Date today);


}
